﻿using System.Collections;
using System.Collections.Generic;
using System.Linq;
using TodoPro.System.Command;
using UnityEngine;
using UnityEngine.SceneManagement;

namespace TodoPro.Test
{
	public class TestScene : MonoBehaviour
	{

		// Use this for initialization
		IEnumerator Start()
		{
			DontDestroyOnLoad(gameObject);
			
			yield return SceneManager.LoadSceneAsync("Runtime");
			
			TodoProConfig.SendCommand(new AddTodoCommand("这是一条测试的 Todo"));
			
			yield return new WaitForSeconds(3.0f);

			var todo = TodoProConfig.GetModel<ITodoModel>().GetAll().Find(t => t.Content == "这是一条测试的 Todo");
			
			TodoProConfig.SendCommand(new RemoveTodoCommand(todo.Id));
			
			yield return new WaitForSeconds(3.0f);

		}
		
	}
}